package com.dt76.smallloanbackendservice.service.ysy.impl;

import com.dt76.smallloanbackendservice.mapper.ysy.ManageMapper;
import com.dt76.smallloanbackendservice.pojo.ysy.ApprovalLoan;
import com.dt76.smallloanbackendservice.service.ysy.ManageService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ManageServiceImpl implements ManageService {
    @Autowired
    private ManageMapper manageMapper;
    @Override
    public Page getAllUser(int pageIndex, String queryname, int roleId) {
        Page page = new Page();
        page.setPageIndex(pageIndex);//每次更新当前页
        //更新总条数
        page.setTotalCount(manageMapper.qryConditionCount(queryname,roleId));
        List<ApprovalLoan> userList = manageMapper.qryConditionPageAll((page.getPageIndex()-1)*page.getPageSize(),
                page.getPageSize(),queryname,roleId
        );
        page.setRows(userList);

        return page;
    }
}
